import request from "@/utils/request";
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询参数列表
export function listAttendanceSum(query) {
  return request({
    url: "/workJobApi/attendance/getAttendanceSum",
    method: "get",
    params: query
  });
}

// 查询详细
export function getAttendanceStatistics(id) {
  return request({
    url: "/workJobApi/attendance/getAttendanceStatistics/" + praseStrEmpty(id),
    method: "get"
  });
}

// 查询详细
export function getAttendanceGroup(id) {
  return request({
    url: "/workJobApi/attendance/" + praseStrEmpty(id),
    method: "get"
  });
}

// 新增用户考勤
export function addAttendanceGroup(data) {
  return request({
    url: "/workJobApi/attendance/",
    method: "post",
    data: data
  });
}

// 修改用户
export function updateAttendanceGroup(data) {
  return request({
    url: "/workJobApi/attendance/",
    method: "put",
    data: data
  });
}

// 删除用户
export function delAttendanceGroup(id) {
  return request({
    url: "/workJobApi/attendance/" + id,
    method: "delete"
  });
}

export function listAttendance(query) {
  return request({
    url: "/workJobApi/attendance/getAttendance",
    method: "get",
    params: query
  });
}

export function exportAttendance(data) {
  return request({
    url: "/workJobApi/attendance/attendanceExport",
    method: "get",
    params: data
  });
}

export function listAttendanceInfo(query) {
  return request({
    url: "/workJobApi/attendance/listAttendanceInfo",
    method: "get",
    params: query
  });
}

export function changStatus(id, status) {
  return request({
    url: "/workJobApi/attendance/modifyAttendanceInfo/" + praseStrEmpty(id),
    method: "get"
  });
}

export function changAttendanceStatus(id,attendanceFlag) {
  return request({
    url: "/workJobApi/attendance/changAttendanceStatus/" + praseStrEmpty(id)+"/"+attendanceFlag,
    method: "get"
  });
}

export function getImg(id) {
  return request({
    url: "/workJobApi/attendance/getImg/" + id,
    method: "get"
  });
}

export function uploadPic(url, file) {
  let data = new FormData();

  file.forEach(everyFile => {
    data.append("file", everyFile.raw);
  });
  return request({
    url: url,
    method: "post",
    data: data
  });
}

// 查询凭证列表
export function getImgList(query) {
  return request({
    url: "/workJobApi/attendance/getImgList",
    method: "get",
    params: query
  });
}
// 删除凭证
export function delImg(id) {
  let data = { id: id };
  return request({
    url: "/workJobApi/attendance/delImg",
    method: "get",
    params: data
  });
}

//提交审核
export function submitAudit(data) {
  return request({
    url: '/workJobApi/attendance/startAuditWorkFlow',
    method: 'post',
    data: data
  })
}


